export const isPointInPolygon = (point, polygon) => {
    let intersections = 0;
    for (let i = 0; i < polygon.length; i++) {
        let currentVertex = polygon[i];
        let nextVertex = polygon[(i + 1) % polygon.length];
        if ((currentVertex[1] > point.latitude) !== (nextVertex[1] > point.latitude) &&
            point.longitude < (nextVertex[0] - currentVertex[0]) * (point.latitude- currentVertex[1]) / (nextVertex[1] - currentVertex[1]) + currentVertex[0]) {
            intersections++;
        }
    }

    return intersections % 2 === 1;
};
export const getPolygon=(polygon)=>{
	
	    const points = [];
	    for (let i = 0; i < polygon.length; i++) {
	        const [longitude, latitude] = polygon[i];
	        const point = {
	            longitude,
	            latitude
	        };
	        points.push(point);
	    }
	    return {points:points,
			strokeWidth: 2,
			strokeColor: '#55aa7f',
			fillColor: 'rgba(0, 0, 0, 0.1)',
			}
		
			
		
	
	
}    